﻿/// <reference path="~/ExtClient/ext/ext-all-debug-w-comments.js" />
Ext.define('app.view.loginwin', {
    extend: 'Ext.Window',
    alias: 'widget.loginwin',

    //layout: 'border',           //fit 将填满整个Window

    layout: {                       //加这个layout，实现了Window中的控件居中
        type: 'vbox',
        align: 'center',
        pack: 'center'
    },
    title: '登录平台',
    titleAlign: 'center',
    width: 400,
    height: 250,
    closable: false,
    resizable: false,
    plain: true,
    border: true,

    //icon: 'content/images/icon_padlock.png',
    icon: '/content/ExtClient/lock.ico',
    initComponent: function () {
        var me = this;

        this.items = [me.createForm()];
        this.callParent(arguments);
    },

    createForm: function () {
        return Ext.create('Ext.form.Panel', {
            id: 'loginform',
            name: 'loginform',
            frame: true,
            height: 150,
            fieldDefaults: {
                msgTarget: 'side',
                autoFitErrors: false
            },
            defaults: {
                width: 280,
                labelWidth: 60,
                labelAlign: 'right',
                allowBlank: false,
                labelSeparator: '   :  ',
                margin: '15',                        //加大了间距
                inputType: 'text'
            },
            defaultType: 'textfield',
            buttonAlign: 'center',                  //按钮居中

            baseCls: 'x-plain',                     //去掉了内部的白底
            border: true,
            items: [{
                fieldLabel: '用户名',
                name: 'UserName',
                id: 'UserName'
            }, {
                fieldLabel: '密码',
                name: 'Password',
                inputType: 'password'
            }
            ],
            buttons: [{
                name: 'loginButton',
                text: '登录',
                action: 'login',
                scale: 'medium',
                width: 100,
                height: 30
            }, {
                name: 'resetButton',
                text: '重置',
                action: 'reset',
                scale: 'medium',
                width: 100,
                height: 30
            },
            {
                name: 'Test',
                text: 'Test',
                scale: 'medium',
                width: 10,
                height: 30
            }
            ]
        });
    }
});